package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreFriend;
import com.fujitsu.nanjing.tieba.ibator.CoreFriendCriteria;
import com.fujitsu.nanjing.tieba.ibator.CoreFriendKey;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreFriendDAOImpl extends SqlMapClientDaoSupport implements CoreFriendDAO {

    public CoreFriendDAOImpl() {
        super();
    }

    public int countByExample(CoreFriendCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_friend.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreFriendCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_friend.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(CoreFriendKey _key) {
        int rows = getSqlMapClientTemplate().delete("core_friend.deleteByPrimaryKey", _key);
        return rows;
    }

    public void insert(CoreFriend record) {
        getSqlMapClientTemplate().insert("core_friend.insert", record);
    }

    public void insertSelective(CoreFriend record) {
        getSqlMapClientTemplate().insert("core_friend.insertSelective", record);
    }

    @SuppressWarnings("unchecked")
    public List<CoreFriend> selectByExample(CoreFriendCriteria example) {
        List<CoreFriend> list = getSqlMapClientTemplate().queryForList("core_friend.selectByExample", example);
        return list;
    }

    public CoreFriend selectByPrimaryKey(CoreFriendKey _key) {
        CoreFriend record = (CoreFriend) getSqlMapClientTemplate().queryForObject("core_friend.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(CoreFriend record, CoreFriendCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_friend.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExample(CoreFriend record, CoreFriendCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_friend.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(CoreFriend record) {
        int rows = getSqlMapClientTemplate().update("core_friend.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKey(CoreFriend record) {
        int rows = getSqlMapClientTemplate().update("core_friend.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreFriendCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreFriendCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}